<%--
  Created by IntelliJ IDEA.
  User: 兰宦君
  Date: 2015/10/8
  Time: 19:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>


<html>
<head>
  <title>后台管理系统——出版社管理</title>
  <%@ include file="../../layout/import.jsp"%>


  <script type="text/javascript">
    function submit() {
      $.ajax({
        url: "/admin/publisherSave.do",
        data: $('#publisherForm').serialize(),
        method: "POST",
        dataType: "json",
        error: function () {
          alert("表单提交出错，请稍后再试");
        },
        success: function(response) {
          if(response.code == 0) {
            alert("修改成功");
            window.location.href = "/admin/publisher.do";

          }
          else {
            alert(response.description);
          }
        }
      });
    }
  </script>
</head>
<body>
<%@ include file="nav.jsp"%>

<div class="container" style="min-height: 72%">
  <div class="col-sm-8 col-sm-offset-2">

    <form class="form" id="publisherForm">
      <div class="form-group">
        <input type="hidden" name="publisherId" value="${publisher.id}">
      </div>
      <div class="form-group">
        <label for="publishername">出版社名</label>
        <input type="text" class="form-control" id="publishername" name="name" value="${publisher.name}">
      </div>
      <div class="form-group">
        <label for="linkman">联系人</label>
        <input type="text" class="form-control" id="linkman" name="linkman" value="${publisher.linkman}">
      </div>
      <div class="form-group">
        <label for="address">作者</label>
        <input type="text" class="form-control" id="address" name="address" value="${publisher.address}">
      </div>
      <div class="form-group">
        <label for="email">邮箱</label>
        <input type="email" class="form-control" id="email" name="email" value="${publisher.email}">
      </div>
      <div class="form-group">
        <label for="phone">电话</label>
        <input type="number" class="form-control" id="phone" name="phone" value="${publisher.phone}">
      </div>
      <div class="form-group">
        <label for="website">网址</label>
        <input type="text" class="form-control" id="website" name="website" value="${publisher.website}">
      </div>

      <a class="btn btn-primary" onclick="submit()">提交</a>

    </form>

  </div>
</div>


<%@ include file="../footer.jsp"%>
</body>
</html>
